package com.zzyl.controller.customer;

import com.zzyl.base.PageResponse;
import com.zzyl.base.ResponseResult;
import com.zzyl.service.NursingProjectService;
import com.zzyl.vo.NursingProjectVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/customer/orders")
@Api(tags = "客户订单")
@Slf4j
public class CustomerOrderController {
    @Autowired
    private NursingProjectService nursingProjectService;


    @GetMapping("/project/page")
    @ApiOperation(value = "分页查询护理项目列表", notes = "分页查询护理项目列表")
    public ResponseResult<PageResponse<NursingProjectVo>> getByPage(
            @RequestParam(value = "page", required = false, defaultValue = "1") Integer pageNum,
            @RequestParam(value = "size", required = false, defaultValue = "10") Integer pageSize,
            @RequestParam(value = "name", required = false) String name,
            @RequestParam(value = "status", required = false) Integer status) {
        PageResponse<NursingProjectVo> nursingProjectPageInfo=nursingProjectService.selectByPage(name, status, pageNum, pageSize);
        return ResponseResult.success(nursingProjectPageInfo);

    }
    @GetMapping("/project/{id}")
    @ApiOperation(value = "根据ID查询护理项目详情", notes = "根据ID查询护理项目详情")
    public ResponseResult<NursingProjectVo> getById(@PathVariable("id") Long id) {
        NursingProjectVo nursingProjectVo=nursingProjectService.findById(id);
        return ResponseResult.success(nursingProjectVo);
    }
}
